package com.wrl.mmall.dao;

import com.wrl.mmall.pojo.User;
import org.apache.ibatis.annotations.Param;

public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);
    // 验证用户名是否存在
    int checkUsername(@Param("username")String username);
    // 验证邮箱
    int checkEmail(@Param("email")String email);
    //登陆
    User selectLogin (@Param("username")String username, @Param("password")String password);
    //返回密码提示问题
    String selectQuestionByUsername(@Param("username")String username);
    //验证问题是否回答正确
    int checkAnswer(@Param("username")String username,@Param("question")String question,@Param("answer")String answer);
    //根据用户名修改密码
    int updatePasswordByUsername(@Param("username")String username, @Param("passwordNew")String passwordNew);
    //登陆后修改密码时，验证旧密码是否可以找到这个用户
    int checkPassword(@Param("password")String passwordNew, @Param("userId")Integer userId);
    //修改用户信息时，查看email除了当前登陆用户，是否还有存在
    int checkEmailByUserId(@Param("email")String email, @Param("userId")Integer userId);


}